home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Columbia Kermit
/
kermit.zip
/
newsgroups
/
misc.20000824-20010305
/
000168_news@columbia.edu _Fri Dec 29 18:42:37 2000.msg
< prev
next >
Wrap
Internet Message Format
|
2020-01-01
|
3KB
Return-Path: <news@columbia.edu>
Received: from watsun.cc.columbia.edu (watsun.cc.columbia.edu [128.59.39.2])
by uhaligani.cc.columbia.edu (8.9.3/8.9.3) with ESMTP id SAA14707
for <kermit.misc@cpunix.cc.columbia.edu>; Fri, 29 Dec 2000 18:42:36 -0500 (EST)
Received: from newsmaster.cc.columbia.edu (newsmaster.cc.columbia.edu [128.59.59.30])
by watsun.cc.columbia.edu (8.8.5/8.8.5) with ESMTP id SAA00425
for <kermit.misc@watsun.cc.columbia.edu>; Fri, 29 Dec 2000 18:42:36 -0500 (EST)
Received: (from news@localhost)
by newsmaster.cc.columbia.edu (8.9.3/8.9.3) id SAA21602
for kermit.misc@watsun.cc.columbia.edu; Fri, 29 Dec 2000 18:31:26 -0500 (EST)
X-Authentication-Warning: newsmaster.cc.columbia.edu: news set sender to <news> using -f
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Converting struct tm to time_t
Date: 29 Dec 2000 15:20:53 -0800
Organization: The Eyrie
Message-ID: <ylu27mq0fe.fsf@windlord.stanford.edu>
To: kermit.misc@columbia.edu
In comp.unix.programmer, Frank da Cruz <fdc@watsun.cc.columbia.edu> writes:
> Russ Allbery <rra@stanford.edu> wrote:
>> Really? I've never seen a Unix system without them, and was under the
>> impression that they were introduced in the early 1980s.
> I don't mean you can't find them, but that using them in portable code
> is often problematic -- which header files to include, where are they,
> what are the argument types and where do you pick up their definitions,
> etc.
True. INN uses a header file called portable/time.h whose contents are:
/* $Id: time.h,v 1.1 2000/10/03 01:27:13 rra Exp $
**
** Portability wrapper around <time.h> and <sys/time.h>.
**
** This header includes <time.h> and <sys/time.h> as applicable, handling
** systems where one can't include both headers (per the autoconf manual).
*/
#ifndef PORTABLE_TIME_H
#define PORTABLE_TIME_H 1
#include "config.h"
#if TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
#else
# if HAVE_SYS_TIME_H
# include <sys/time.h>
# else
# include <time.h>
# endif
#endif
#endif /* PORTABLE_TIME_H */
and just includes that instead of time.h or sys/time.h. This requires
that you be using autoconf and include:
AC_HEADER_TIME
AC_CHECK_HEADERS(sys/time.h)
among your configure checks, though.
> Right, sorry, I meant mktime(). But again, just because some standard
> requires certain behavior doesn't make it happen, especially when some
> of the mktime() implementations precede the standard.
True, but I believe that the normalization function of mktime() was part
of the original intent of the function. It would really surprise me to
find an implementation that doesn't do that.
--
Russ Allbery (rra@stanford.edu) <http://www.eyrie.org/~eagle/>